package main

import (
	"sync"
	configwechat "wechat/src/configs/wechat"
	servicewechat "wechat/src/service/wechat"
	"wechat/src/tools"
)

func main() {
	
	var wgp = new(sync.WaitGroup)
	statusTube := make(chan string, 1)

	if is := tools.FileExists(configwechat.CacheSaveFile); is {
		if err := servicewechat.Restore(wgp); err == nil {
			goto end
		}
	}

	servicewechat.Auth(wgp, statusTube)

	servicewechat.User(wgp, statusTube)
end:

	wgp.Wait()
}
